#ifndef _LOG_H_
#define _LOG_H_

#include <stdio.h>
#include <stdarg.h>

#define LOG_DEBUG   3
#define LOG_INFO    2
#define LOG_ERROR   1
#define LOG_NULL    0

#define LOG_BUFF  81920

int gettime(char *out,int fmt);
void writelog(int level,char *fmt,...);
void initlog(int mode,int level,char *path);/*1:toconsole,0:tofile*/

#define WRITE_DEBUG(fmt,...) writelog(LOG_DEBUG,fmt,##__VA_ARGS__)
#define WRITE_INFO(fmt,...) writelog(LOG_INFO,fmt,##__VA_ARGS__) 
#define WRITE_ERROR(fmt,...) writelog(LOG_ERROR,fmt,##__VA_ARGS__)

#endif
